Skip to content

feat(codegen): generate wasm bridge callbacks#265

Open
pgherveou wants to merge 76 commits into
mainfrom
rust-core/04-wasm-bridge-codegen
Open

feat(codegen): generate wasm bridge callbacks#265
pgherveou wants to merge 76 commits into
mainfrom
rust-core/04-wasm-bridge-codegen

Conversation

@pgherveou

@pgherveou pgherveou commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the generated Rust wasm-bindgen platform bridge and derives host callback namespace/adapter names from truapi-platform trait metadata.

The codegen pipeline no longer hardcodes the current platform trait set. Adding a new platform trait should only require providing the corresponding JS namespace/adapter implementation, not changing the Rust/TS codegen selection logic.

This layer also updates generated goldens for namespaced HostCallbacks, FlatHostCallbacks compatibility, RequiredHostCallbacks, and encoded platform-local bridge payloads.

Stack

Part of the Rust core runtime port umbrella #104. Full port sequence:

  1. feat(truapi): add testing API and versioned wiring #248 - layer 1/9, merged historical: truapi testing API and versioned wiring.
  2. feat(truapi-platform): add host capability traits #249 - layer 2/9, merged historical: truapi-platform host capability traits.
  3. feat(truapi-codegen): emit Rust dispatcher, wire table, and host callbacks #254 - layer 3/9, merged historical: codegen Rust dispatcher, wire table, and host callbacks.
  4. feat(truapi-server): add host logic primitives #255 - layer 4/9, merged historical: server host logic primitives.
  5. feat(truapi-server): add wire and chain infrastructure #256 - layer 5/9, merged historical: server wire and chain infrastructure.
  6. feat(truapi-server): add platform runtime and host bridge #250 - active layer 1/4: server runtime, permissions, lifecycle, and permission-flow docs.
  7. 👉 feat(codegen): generate wasm bridge callbacks #265 - active layer 2/4: generic wasm bridge/codegen layer. This PR.
  8. feat(host-wasm): add @parity/truapi-host-wasm runtime #252 - active layer 3/4: @parity/truapi-host-wasm namespaced callback consumer.
  9. chore: docs, CI, tooling, and dotli integration for the Rust core #253 - active layer 4/4, top: docs, CI/tooling, playground, and dotli integration.

Active child #253 is kept tree-equivalent with umbrella #104.

Validation

  • cargo fmt --all --check
  • cargo check -p truapi-codegen
  • cargo check -p truapi-server
  • cargo test -p truapi-codegen golden_
  • TRUAPI_SKIP_PACKAGE_BUILD=1 ./scripts/codegen.sh

pgherveou added 30 commits July 1, 2026 08:34
Adds the canonical testing module (api/testing.rs) and its v01/v02/versioned
wiring used by the Rust host runtime and generated clients.
New crate defining the host syscall traits (storage, navigation, consent,
permissions, ...) that host runtimes implement. Types are re-exported from
truapi::versioned/v01 rather than redefined.
…backs

Extends the rustdoc-JSON code generator to emit the Rust dispatcher and wire
table consumed by truapi-server, plus the TS host-callbacks adapter. Golden
tests pin the emitted shapes.
Comment thread rust/crates/truapi-server/src/lib.rs
Comment thread rust/crates/truapi-codegen/src/platform_callbacks.rs
Base automatically changed from rust-core/03-server-runtime to main July 9, 2026 07:43
@pgherveou pgherveou requested a review from a team July 9, 2026 07:43
pgherveou added 2 commits July 9, 2026 10:02
…dge-codegen

# Conflicts:
#	rust/crates/truapi-codegen/tests/golden/host-callbacks-adapter.ts
#	rust/crates/truapi-codegen/tests/golden/host-callbacks.ts
#	rust/crates/truapi-codegen/tests/golden/worker-callbacks.ts
#	rust/crates/truapi-codegen/tests/golden_rust_emit.rs
#	rust/crates/truapi-server/src/lib.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants